package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
import javax.persistence.*;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 硬件方案对应相应硬件类型
 */
@Entity
@Table(name = "tnb_device_type_item")
@JsonApiResource(type = "deviceTypeItem")
public class DeviceTypeItem extends BaseEntity {
	private DeviceType type;// 硬件方案
	private Dicttype item;// 硬件类型
	private String remark;// 备注

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "type_id", foreignKey = @ForeignKey(name = "null"))
	public DeviceType getType() {
		return type;
	}

	public void setType(DeviceType type) {
		this.type = type;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "item_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getItem() {
		return item;
	}

	public void setItem(Dicttype item) {
		this.item = item;
	}

	
	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
}